草庐IT

java - windows下socket读取超时: strange hardcode in native method

全部标签

javascript - 读取未知属性的名称

我有一个简单的javascript对象,它有几个包含值的未知属性。问题是我真的不知道字段的名称,因为它是可变的。我怎样才能访问这个未知的属性?为了更好地理解,我有一个简单的对象,如下所示:vara={cat:"meow",dog:"woof"};我需要读取不同属性的名称和值。我在想类似下面的事情:a.getField(0).name。 最佳答案 你可以这样做:for(varmemberina){alert('Name:'+member);alert('Value:'+a[member]);}有关JS中反射的更多信息,请参见此处:ht

java - 在 Java.util.Date 中解析 org.mozilla.javascript.NativeDate

我正在尝试将从使用rhino库评估的JavaScript脚本获取的日期解析为java.util.Date,我可以将org.mozilla.javascript.NativeDate转换为java.util.Date吗?如果使用Context.tostring方法将NativeDate转换为字符串,我将获得以下格式的日期:WedOct12201116:17:59GMT+0200(CEST)如何将此字符串日期表示解析为java.util.Date对象? 最佳答案 在Rhino中使用context.jsToJava(nativeDateO

javascript - 从 iFrame/Window 访问 JavaScript 中的父对象

如何在子窗口中访问定义在父窗口中的全局对象或数组。varevents_data;functionfunction_to_fill_events_data(){...}当我在迷你文档中时,我希望能够访问javascript函数中的events_data变量。 最佳答案 选项1您的标题提到了一个子窗口。如果你有一个子窗口,而不是一个iframe,使用这个:window.opener.events_data查看window.openeronMDN.选项2您的代码表明您使用的是iframe。在iframe中,只需使用parent:paren

javascript - 对象不支持 Internet Explorer 10 (Windows 8) 中的属性或方法 'transformNode'

我遇到了一些JavaScript问题,这些问题似乎只发生在Windows8上的InternetExplorer10中(IE7、8和9都可以正常工作)。我所做的基本工作是从Web服务获取XML和XSL,然后在JavaScript中转换它们以使用Sys.Net.XMLDOM对象呈现在页面上。XMLDOM=Sys.Net.XMLDOM;varxsl=//XSLgottenfromsomewhereelsevarxmlString=//XMLgottenfromsomewhereelseasastring...varxml=newXMLDOM(xmlString);varcontent=xml

javascript - Window.open 调整到可用的宽度和高度

我已经做了一些搜索,但我看不出这是否可行。我想使用window.open()方法打开指向窗口可用宽度和高度的链接。类似于下面的代码。varh=$(window).height();varw=$(window).width();$('#window-opener').live('click',function(e){window.open(this.href,'Resource','toolbar=no,location=0,status=no,titlebar=no,menubar=no,width='+w',height='+h);e.preventDefault();});这可能吗

javascript - 无法读取 meteor.JS 函数中未定义的属性 'profile'?

我有以下代码:Template.analyze.userFullName=function(){varu=Meteor.users.findOne({_id:this.userId},{fields:{name:1}});returnu.profile.name;};Meteor.users.findOne({_id:this.userId},{fields:{name:1}})在控制台中使用时返回以下内容:Object_id:"79ef0e67-6611-4747-b669-45cc163cc1d8"profile:Objectname:"MyName"但是当我在上面的代码中使用它时

javascript - window.title 和 document.title 的区别

我一直在阅读有关JavaScript的Material,有两种方法可以访问页面的title:window.title属性document.title属性但是在申请的时候,第二个才有效。我无法理解为什么有两个标题以及为什么它们都不起作用。 最佳答案 window.document.title是正确的。window.title不正确,因为thewindowobjectdoesn'thaveatitleproperty(窗口的所有属性都在左侧下方,您会看到title不存在)。 关于javasc

javascript - 如何在 asp.net mvc 中重置 session 超时

我想在用户仍处于事件状态时重置session超时。在我的场景中,我的session超时是20分钟,当session时间在10秒之前达到时我正在显示一个对话框以确认用户“session将超时,你想留在吗??”。如果用户单击"is",我想从第21分钟开始再次继续我的session20分钟,因为根据要求,我将在数据库表中保存用户session时间。我们可以为session超时设置计时器吗?所以,请任何人帮助我,如何重置session超时?? 最佳答案 像这样编写jQuery脚本:(document).ready(function(){$(

JavaScript fullCalendar 插件读取 'applyAll' 在 gcal.js 中未定义

我正在尝试在JavaScript中使用fullcalendar插件的谷歌日历模块。当我尝试加载谷歌日历时,控制台显示:UncaughtTypeError:Cannotreadproperty'applyAll'ofundefined错误发生在gcal.js的第23行:21|varfc=$.fullCalendar;22|console.log($.fullCalendar);23|varapplyAll=fc.applyAll;我添加的console.log()返回$.fullCalendar为未定义,然后fc.applyAll也返回未定义。我对JS的了解不足以完全理解这个文件中发生的

javascript - 如何在 Windows 上打包 NW.js 应用程序

IamreadingtheinstructionsforhowtopackageaNW.jsapp措辞困惑,毫无意义。我突出显示了相互矛盾的单词沙拉部分。Createazipfile(thisisbuiltintoXP,Vistaand7)Copyallofyourfilesintothezipfile,retainingdirectorystructureandmakingsurethatthepackage.jsonfileisintherootdirectory(ifyoumakeazipfilecontainingafolderwithyourstuffinit,thenit'